package com.atguigu.condition;

import com.atguigu.bean.Blue;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.util.MultiValueMap;

import java.util.Set;

public class MyImportSelector implements ImportSelector {
    //返回值，就是要导入的组件的全类名

    /**
     *
     * @param importingClassMetadata 可以获取到这个注解中所有的信息
     * @return
     */
    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
//        Set<String> annotationTypes = importingClassMetadata.getAnnotationTypes();
//        String className = importingClassMetadata.getClassName();
//        String[] memberClassNames = importingClassMetadata.getMemberClassNames();
//        System.out.println("----");
////        System.out.println(annotationTypes);
//        for (String annotationType : annotationTypes) {
//            MultiValueMap<String, Object> allAnnotationAttributes = importingClassMetadata.getAllAnnotationAttributes(annotationType);
//            System.out.println(annotationType + "---");
//        }
////        System.out.println(className);
////        System.out.println(memberClassNames);
//        System.out.println("----");
        return new String[]{"com.atguigu.bean.Blue", "com.atguigu.bean.Yellow"};
    }
}
